import { fromJS, List } from "immutable";
import { GET_SHOWLISTTABA_DATA, GET_SHOWLISTACON_DATA } from "./actionType";

const defaultState = fromJS({
  list: []
});
export default (state = defaultState, action) => {
  // eslint-disable-next-line default-case
  switch (action.type) {
    case GET_SHOWLISTTABA_DATA:
      return state
        .update("list", x => List((x = [])))
        .set("list", fromJS(action.val));
    case GET_SHOWLISTACON_DATA:
      return state.update(
        "list",
        fromJS(x => x.concat(fromJS(action.val)))
      );
  }
  return state;
};
